﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="BoardSquareViewModel.cs" company="">
//   
// </copyright>
//  <summary>
//   The board square view model.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Shatranj
{
    /// <summary>
    /// The board square view model.
    /// </summary>
    public class BoardSquareViewModel : BoardSquareViewModel<ViewModel>
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="BoardSquareViewModel"/> class.
        /// </summary>
        public BoardSquareViewModel()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="BoardSquareViewModel"/> class.
        /// </summary>
        /// <param name="square">
        /// The square.
        /// </param>
        /// <param name="parent">
        /// The parent.
        /// </param>
        public BoardSquareViewModel(BoardSquare square, ViewModel parent)
            : base(square, parent)
        {
        }

        #endregion
    }

    /// <summary>
    /// The board square view model.
    /// </summary>
    /// <typeparam name="T">
    /// </typeparam>
    public class BoardSquareViewModel<T> : ViewModel
        where T : ViewModel
    {
        #region Fields

        /// <summary>
        /// The current square.
        /// </summary>
        private BoardSquare currentSquare;

        /// <summary>
        /// The is enabled.
        /// </summary>
        private bool isEnabled;

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="BoardSquareViewModel{T}"/> class.
        /// </summary>
        public BoardSquareViewModel()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="BoardSquareViewModel{T}"/> class.
        /// </summary>
        /// <param name="square">
        /// The square.
        /// </param>
        /// <param name="parent">
        /// The parent.
        /// </param>
        public BoardSquareViewModel(BoardSquare square, T parent)
            : this()
        {
            this.CurrentSquare = square;
            this.Parent = parent;
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets or sets the current square.
        /// </summary>
        public BoardSquare CurrentSquare
        {
            get
            {
                return this.currentSquare;
            }

            set
            {
                this.currentSquare = value;
                this.RaisePropertyChanged("CurrentSquare");
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether is enabled.
        /// </summary>
        public bool IsEnabled
        {
            get
            {
                return this.isEnabled;
            }

            set
            {
                this.isEnabled = value;
                this.RaisePropertyChanged("IsEnabled");
            }
        }

        /// <summary>
        /// Gets or sets the parent.
        /// </summary>
        public T Parent { get; set; }

        #endregion
    }
}